<?php

class Controller_Site_Profile extends Controller_Action 
{
	/**
	 *
	 * @var ProfileRow
	 */
	protected $profile;
	
	/**
	 *
	 * @var ProfileService
	 */
	protected $profileService;
	
	/**
	 * @return ProfileService
	 */
	public function getProfileService() {
		if (!$this->profileService) {
			$this->profileService = ProfileService::getInstance();
		}
		return $this->profileService;
	}
	public function preDispatch()
	{
		$user = $this->_getProfile();
		if (!$user) {
			$this->_goto(array('module' => 'default', 'controller' => 'error', 'action' => 'forbidden'), null, true);
			return ;
		}
		$this->profile = $user;
		parent::preDispatch();
	}
}